//
//  FormImageHandle.m
//  LFCApp
//
//  Created by Lssyyy on 2019/3/21.
//  Copyright © 2019年 Lssyyy. All rights reserved.
//

#import "FormHandle.h"
#import <UIKit/UIKit.h>
@implementation FormHandle


+ (NSMutableDictionary *)getFormAllInfoWithDatas:(NSArray *)datas{
   
    return nil;
}

+ (void)jm_checkFormNullDataWithWithDatas:(NSArray *)datas success:(void(^)(void))success failure:(void(^)(NSString *error))failure {
    for (int sec = 0; sec < datas.count; sec++) {
        FormSectionItem *sectionItem = datas[sec];
        for (int row = 0; row < sectionItem.items.count; row++) {
            CouponFormItem *rowItem = sectionItem.items[row];
            if (rowItem.required) {
                if (rowItem.itemType == CouponFormItemTypeNormal) {
                    if (!rowItem.info || [rowItem.info isEqualToString:@""]) {
                        failure([NSString stringWithFormat:@"%@%@",JMLocalStr(@"请输入"), rowItem.title]);
                        return;
                    }
                }
                else if (rowItem.itemType == CouponFormItemTypeTimeSelected) {
                    if (!rowItem.info || [rowItem.info isEqualToString:@""]) {
                        failure([NSString stringWithFormat:@"%@%@",JMLocalStr(@"请选择"),rowItem.title]);
                        return;
                    }
                }
            }
        }
    }
    success();
}
@end
